package com.lipaluma.test.db.annotations.clean;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import com.lipaluma.test.db.internal.DialectEnum;
import com.lipaluma.test.db.internal.clean.CleanStrategy;

/**
 * Clean defined tables in the database. The clean can be done by TRUNCATE or by DELETE.<br>
 * Tables will be cleaned in the order of the array.
 * 
 * @author Mario
 */
@Documented
@Inherited
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface CleanTables {

	/**
	 * schema of the database. If not defined, it will take the default schema
	 * @return
	 */
	String schema() default "";

	/**
	 * array of the tables to clean. Care of the order if tables have foreign keys.
	 * @return
	 */
	String[] tables() ;
	
	/**
	 * clean before the test. Default is true
	 * @return
	 */
	boolean before() default true;
	
	/**
	 * clean after the test. After is true
	 * @return
	 */
	boolean after() default false;
	
	CleanStrategy strategy() default CleanStrategy.TRUNCATE;

	/**
	 * Define the dialect for the load data request
	 * @return
	 */
	DialectEnum dialect() default DialectEnum.MYSQL;
	
	/**
	 * define the name of the Data Source
	 * @return
	 */
	String dataSource() default "";
	
	/**
	 * defines a list of {@link CleanTables}.
	 * @author Mario
	 *
	 */
	@Documented
	@Inherited
	@Target({ElementType.METHOD, ElementType.TYPE})
	@Retention(RetentionPolicy.RUNTIME)
	public @interface List {
		CleanTables[] value();
	}
	
}
